/*
   The "Fizz-Buzz test" is an interview question designed to help filter out bad programmers
   Copyright (C) 2014 Nicholas Bailey

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
package main

import (
	"fmt"
	"os"

	"github.com/codegangsta/cli"
)

func gplHeader() string {
	return "Copyright (C) 2014  Nicholas Bailey\n" +
		"    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w`.\n" +
		"    This is free software, and you are welcome to redistribute it\n" +
		"    under certain conditions; type `show c` for details."
}

func run(ctx *cli.Context) {
	for i := 0; i < 100; i++ {
		if i%15 == 0 {
			fmt.Println("FizzBuzz")
		} else if i%3 == 0 {
			fmt.Println("Fizz")
		} else if i%5 == 0 {
			fmt.Println("Buzz")
		} else {
			fmt.Println(i)
		}
	}
}

func main() {
	app := cli.NewApp()
	app.Usage = "An implementation of a popular interview question designed to help filter out bad programmers."
	app.Version = gplHeader()
	app.Author = "Nicholas Bailey"
	app.Action = run
	app.Run(os.Args)
}
